package edu.sandau.b230151.b23015128.service;

import edu.sandau.b230151.b23015128.model.Goods;
import edu.sandau.b230151.b23015128.repository.GoodsRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Component;

@Component
public class GoodsService {
    @Autowired
    private GoodsRepository goodsRepository;
    public Object finAll(Goods goods)
    {
        return goodsRepository.findAll(Example.of(goods));
    }

    public void deleteById(String id){
        goodsRepository.deleteById(id);
    }

    public void save(Goods s){
        goodsRepository.save(s);
    }

    public Goods getReferenceById(String id){
        return goodsRepository.getReferenceById(id);
    }
}
